#include <stdio.h>

#define rate1 0.15
#define rate2 0.28
#define money1 17850
#define money2 23900
#define money3 29750
#define money4 14875
#define Base1 (rate1*17850)
#define Base2 (rate1*23900)
#define Base3 (rate1*29750)
#define Base4 (rate1*14875)
int main(void)
{
	char type;
	double salary,tax;
	printf("please Enter your type and salary\n");
	printf("type: a-single; b-citizen; c-married; d-dismarried\n");
	while(1){
		getchar();
		scanf("%c",&type);
		printf("you salary: $\n");
		scanf("%lf", &salary);
		switch(type){
			case 'a':
				{
				if(salary<=money1)
					tax=rate1*salary;
				else
					tax=Base1+rate2*(salary-money1);	
				break;
				}
			case 'b':
				{
				if(salary<=money2)
					tax=rate1*salary;
				else
					tax=Base2+rate2*(salary-money2);
				break;				
				}
			case 'c':
				{
				if(salary<=money3)
					tax=rate1*salary;
				else
					tax=Base3+rate2*(salary-money3);
				break;	
				}
			case 'd':
				{
				if(salary<=money4)
					tax=rate1*salary;
				else
					tax=Base4+rate2*(salary-money4);
				break;					
				}
			default:
				break;				
		}
	printf("you should pay %.2lf in tax\n", tax);	
	}
	
	return 0;
}
